package com.woniuxy.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.work.framework.pojo.Chat;
import com.work.framework.pojo.UserInfo;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @Author: wanghao
 * @Date: 2019/9/19 17:38
 */
@Mapper
@Repository
public interface ChatMapper extends BaseMapper<Chat> {
    @Select("select b_uid from chat where p_uid = #{p_uid} and flage=1")
    @Results({
            @Result(column = "b_uid", property = "b_uInfo",
            one = @One(
                    select = "findUserInfoById"
            )),
    })
    List<Chat> selectChatByMap(Map<String, Object> map);

    @Select("select * from user_info where uid = #{uid}")
    UserInfo findUserInfoById(Integer uid);
}
